package nuc.edu.tlias.controller;

import lombok.extern.slf4j.Slf4j;
import nuc.edu.tlias.pojo.Emp;
import nuc.edu.tlias.pojo.LoginInfo;
import nuc.edu.tlias.pojo.Result;
import nuc.edu.tlias.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private EmpService empService;


    @PostMapping
    public Result login(@RequestBody Emp emp){
        log.info("=====登录：{}",emp );
        LoginInfo loginInfo =  empService.login(emp);
        return Result.success(loginInfo);
    }

}
